package live

import (
	"vrcm/src/vrcm/app/admin/models/likes"
	"vrcm/src/vrcm/common/models"
)

type LiveBasic struct {
	models.Model

	LiveName       string `json:"live_name" gorm:"type:varchar(100);comment:直播名称"`
	TenantId       string `json:"tenant_id" gorm:"type:varchar(35);comment:租户"`
	GroupId        string `json:"group_id" gorm:"type:varchar(50);comment:im appid"`
	AppId          int64  `json:"app_id" gorm:"type:int;comment:群组id"`
	Scene          int    `json:"scene" gorm:"type:tinyint;comment:直播场景 1标准直播 2互动直播 3多视角直播"`
	LiveMode       int    `json:"live_mode" gorm:"type:tinyint;comment:直播方式 1无延时 2低延时 3常规延时"`
	LiveSource     int    `json:"live_source" gorm:"type:tinyint;comment:直播来源 1视频文件 2直播信号"`
	RoomType       int    `json:"room_type" gorm:"type:tinyint;comment:直播来源 1快直播 2慢直播"`
	Delay          int    `json:"delay" gorm:"type:int;comment:直播延迟 默认0s"`
	LiveTime       int64  `json:"live_time" gorm:"type:int;comment:直播时间"`
	LiveState      int    `json:"live_state" gorm:"type:tinyint;comment:直播间状态 1未开始 2直播中 3暂停 4已结束 5彩排"`
	Notice         string `json:"notice" gorm:"type:varchar(500);comment:公告"`
	LogUrl         string `json:"log_url" gorm:"type:varchar(300);comment:直播封面图片地址"`
	Desc           string `json:"desc" gorm:"type:text;comment:简介"`
	VideoListName  string `json:"video_list_name" gorm:"type:varchar(20);comment:回看列表名称"`
	BasicNum       int    `json:"basic_num" gorm:"type:int;comment:基础人数"`
	Multiple       int    `json:"multiple" gorm:"type:int;comment:倍数"`
	GuideFace      string `json:"guide_face" gorm:"type:varchar(300);comment:引导页封面"`
	GuideBack      string `json:"guide_back" gorm:"type:varchar(300);comment:引导页背景"`
	GuideLogo      string `json:"guide_logo" gorm:"type:varchar(300);comment:引导页logo"`
	RoundId        int    `json:"round_id" gorm:"type:varchar(50);comment:场次id"`
	LikesId        int    `json:"likes_id" gorm:"type:int;comment:点赞记录id"`
	TaskId         string `json:"task_id" gorm:"type:varchar(50);comment:录制任务id"`
	IsDelete       int    `json:"is_delete" gorm:"type:int;comment:收否删除 1删除 2 未删除"`
	IsConfirm      int    `json:"is_confirm" gorm:"type:int;comment:是否确认录制 1是 2否"`
	RoundStartTime int    `json:"round_start_time" gorm:"type:int;comment:场次开始时间"`
	LiveType       int    `json:"live_type" gorm:"type:tinyint;comment:直播类型 1直播 2点播"`
	VideoUrl       string `json:"video_url"  gorm:"type:varchar(300);comment:直播地址"`
	BindId         string `json:"bind_id"  gorm:"type:varchar(300);comment:关联id"`
	CorpId         string `json:"corp_id"  gorm:"type:varchar(300);comment:企业id"`
	CorpIdSecret   string `json:"corp_id_secret"  gorm:"type:varchar(300);comment:企业id密文"`
	CorpAgentId    string `json:"corp_agent_id"  gorm:"type:varchar(300);comment:企业agentId"`
	PermanentCode  string `json:"permanent_code"  gorm:"type:varchar(300);comment:永久授权码"`
	DrawId         string `json:"draw_id"  gorm:"type:varchar(300);comment:企业id"`
	EventId        string `json:"event_id"  gorm:"type:varchar(100);comment:事件号id"`
	MergeScreenId  int    `json:"merge_screen_id"  gorm:"type:bigint;comment:合屏id"`

	models.ModelTime
	models.ControlBy
}

func (LiveBasic) TableName() string {
	return "live_basic"
}

func (e *LiveBasic) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *LiveBasic) GetId() interface{} {
	return e.Id
}

type LiveMonitorRecord struct {
	models.Model
	TenantId      string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	BasicId       int    `json:"basic_id" gorm:"type:varchar(35);comment:基本信息id"`
	LiveId        string `json:"live_id" gorm:"type:varchar(50);comment:直播id"`
	PullTaskId    string `json:"pull_task_id" gorm:"type:varchar(300);comment:拉流直播任务id"`
	FlvUrl        string `json:"flv_url" gorm:"type:varchar(300);comment:flv拉流地址"`
	HlsUrl        string `json:"hls_url" gorm:"type:varchar(300);comment:hls拉流地址"`
	RtmpUrl       string `json:"rtmp_url" gorm:"type:varchar(300);comment:rtmp推流地址"`
	ViewUrl       string `json:"view_url" gorm:"type:varchar(300);comment:观看地址"`
	MobileUrl     string `json:"mobile_url" gorm:"type:varchar(300);comment:移动端观看二维码"`
	PushUrl       string `json:"push_url" gorm:"type:varchar(300);comment:推流地址"`
	WebrtcUrl     string `json:"webrtc_url" gorm:"type:varchar(300);comment:webrtc拉流地址"`
	PreviewUrl    string `json:"preview_url" gorm:"type:varchar(300);comment:预览地址"`
	ExpireTime    int64  `json:"expire_time" gorm:"type:int;comment:失效时间"`
	RoomAddress   string `json:"room_address"  gorm:"type:varchar(100);comment:房间地址"`
	RoomNo        string `json:"room_no" gorm:"type:varchar(10);comment:房间号"`
	PullStreamUrl string `json:"pull_stream_url" gorm:"type:varchar(1000);comment:拉流地址"`
	StreamType    int    `json:"stream_type" gorm:"type:tinyint;comment:当前流类型 1推流直播 2拉流直播 "`
	IsDelete      int    `json:"is_delete" gorm:"type:int;comment:收否删除 1删除 2 未删除"`
	ViewName      string `json:"view_name" gorm:"type:varchar(50);comment:视角名"`
	ViewNo        int    `json:"view_no" gorm:"type:int;comment:视角序号"`
	PullState     int    `json:"pull_state" gorm:"type:tinyint;comment:1开启2关闭"`
	VideoInfo     string `json:"video_info"  gorm:"type:varchar(500);comment:视频信息"`
	models.ModelTime
	models.ControlBy
}

type LiveBasicWithStream struct {
	BasicInfo           LiveBasicModel      `json:"basic_info" comment:"直播间基本信息"`
	StreamInfos         []LiveMonitorRecord `json:"stream_infos" comment:"直播流信息"`
	StreamInfo          LiveMonitorRecord   `json:"stream_info" comment:"直播流信息"`
	GroupInfos          []GroupInfo         `json:"group_infos" comment:"聊天群组信息"`
	Likes               likes.Likes         `json:"likes" comment:"点赞记录"`
	CorpId              string              `json:"corp_id" comment:"企业微信id"`
	AgentId             string              `json:"agent_id" comment:"微信应用id"`
	PublicAgentId       string              `json:"public_agent_id" comment:"微信应用id"`
	ProviderAccessToken string              `json:"provider_access_token" comment:""`
	LiveAddress         string              `json:"live_address" comment:"直播地址"`
	EnterpriseWxAppId   string              `json:"enterprise_wx_app_id" comment:"企业微信id"`
}

type LiveBasicModelForLive struct {
	LiveBasic         `json:"basic_info" comment:"直播间基本信息"`
	LiveMonitorRecord `json:"stream_info" comment:"直播流信息"`
}

type LiveBasicModel struct {
	LiveBasic
	GuidId            int   `json:"guid_id" comment:"引导页设置id"`
	EnableGuid        int   `json:"enable_guid" comment:"是否启用引导页 1是 2 否"`
	VirtualNumId      int   `json:"virtual_num_id" comment:"是否启用虚拟人数id"`
	EnableVirtualNum  int   `json:"enable_virtual_num" comment:"是否启用虚拟人数 1是 2否"`
	IMId              int   `json:"im_id" comment:"聊天室设置id"`
	EnableIM          int   `json:"enable_im" comment:"是否启用弹幕 1是 2否"`
	LikesId           int   `json:"likes_id" comment:"点赞设置id"`
	EnableLikes       int   `json:"enable_likes" comment:"是否启用点赞 1是 2否"`
	CommentId         int   `json:"comment_id" comment:"点赞设置id"`
	EnableComment     int   `json:"enable_comment" comment:"是否启用评论 1是 2否"`
	IsAudit           int   `json:"is_audit" comment:"是否启用评论审核 1是 2否"`
	CountDownId       int   `json:"count_down_id" comment:"倒计时id"`
	EnableCountDown   int   `json:"enable_count_down" comment:"是否启用倒计时 1是 2否"`
	ReservationId     int   `json:"reservation_id" comment:"预约id"`
	EnableReservation int   `json:"enable_reservation" comment:"是否启用预约 1是 2否"`
	IsRecord          int64 `json:"is_record" comment:"是否录制 1是 2 否"`
}

type GroupInfo struct {
	GroupId         string   `json:"GroupId"`
	Type            string   `json:"Type"`
	Name            string   `json:"Name"`
	Appid           int64    `json:"Appid"`
	Introduction    string   `json:"Introduction"`
	Notification    string   `json:"Notification"`
	FaceUrl         string   `json:"FaceUrl"`
	OwnerAccount    string   `json:"Owner_Account"`
	CreateTime      int64    `json:"CreateTime"`
	LastInfoTime    int64    `json:"LastInfoTime"`
	LastMsgTime     int64    `json:"LastMsgTime"`
	NextMsgSeq      int64    `json:"NextMsgSeq"`
	MemberNum       int64    `json:"MemberNum"`
	MaxMemberNum    int64    `json:"MaxMemberNum"`
	ApplyJoinOption string   `json:"ApplyJoinOption"`
	MuteAllMember   string   `json:"MuteAllMember"`
	MemberList      []Member `json:"member_list"`
}

type Member struct {
	Account string `json:"member_account"` //成员
	Role    string `json:"role"`           //角色
}

type Personalization struct {
	models.Model
	LiveId   int `json:"live_id" gorm:"type:varchar(50);comment:直播id"`
	Kind     int `json:"kind" gorm:"type:tinyint;comment:1.引导页 2 虚拟人数 3 IM 4 点赞 5评论 6观看次数 7倒计时 8预约"`
	IsEnable int `json:"is_enable" gorm:"type:int;comment:1 启用 2 禁用"`
	IsAudit  int `json:"is_audit" gorm:"type:int;comment:1 是 2 否"`
	models.ModelTime
	models.ControlBy
}

type Portal struct {
	models.Model
	TenantId      string `json:"tenant_id" gorm:"type:varchar(50);comment:租户id"`
	PortalName    string `json:"portal_name" gorm:"type:varchar(50);comment:门户名称"`
	PortalDesc    string `json:"portal_desc" gorm:"type:varchar(500);comment:门户简介"`
	PortalLogo    string `json:"portal_logo" gorm:"type:varchar(300);comment:门户logo"`
	PortalFaceUrl string `json:"portal_face_url" gorm:"type:varchar(300);comment:门户封面"`
	PortalAddress string `json:"portal_address" gorm:"-" comment:"门户地址"`
	models.ModelTime
	models.ControlBy
}

type PortalModel struct {
	Portal        Portal `json:"portal"`
	TotalLikeNum  int64  `json:"total_like_num" comment:"点赞数"`
	LiveNum       int    `json:"live_num" comment:"直播间次数"`
	PortalAddress string `json:"portal_address" comment:"门户地址"`
}

type PublishSetting struct {
	models.Model
	TenantId     string `json:"tenant_id" gorm:"type:varchar(50);comment:租户id"`
	LiveId       int    `json:"live_id" gorm:"type:bigint;comment:直播id"`
	Title        string `json:"title" gorm:"type:varchar(100);comment:标题"`
	Introduction string `json:"introduction" gorm:"type:varchar(500);comment:简介"`
	LogoUrl      string `json:"logo_url" gorm:"type:varchar(500);comment:logo"`
	models.ModelTime
	models.ControlBy
}

type ThirdPush struct {
	models.Model

	TenantId  string `json:"tenant_id" gorm:"type:varchar(35);comment:租户"`
	Platform  string `json:"platform" gorm:"type:varchar(100);comment:平台"`
	BasicId   int    `json:"basic_id" gorm:"type:varchar(35);comment:基本信息id"`
	TaskId    string `json:"task_id" gorm:"type:varchar(50);comment:录制任务id"`
	PushUrl   string `json:"push_url" gorm:"type:varchar(300);comment:转推地址"`
	PushState int    `json:"push_state" gorm:"type:tinyint;comment:转推地址 1开启 2关闭"`
	models.ModelTime
	models.ControlBy
}

func (ThirdPush) TableName() string {
	return "third_push"
}

type BlackUser struct {
	models.Model

	TenantId  string `json:"tenant_id" gorm:"type:varchar(35);comment:租户"`
	LiveId    int    `json:"live_id" gorm:"type:bigint;comment:直播间id"`
	UserId    string `json:"user_id" gorm:"type:varchar(100);comment:用户id"`
	UserName  string `json:"user_name" gorm:"type:varchar(100);comment:用户名"`
	HeadUrl   string `json:"head_url" gorm:"type:varchar(300);comment:用户头像"`
	BlackType int    `json:"black_type" gorm:"type:tinyint;comment:用户状态 1禁言 2踢出 3黑屋 "`
	UserState int    `json:"user_state" gorm:"type:tinyint;comment:用户状态 1开启 2取消"`
	models.ModelTime
	models.ControlBy
}

func (BlackUser) TableName() string {
	return "black_user"
}
